package Junit5;

import java.time.Duration;
import java.time.LocalDateTime;

public class PhoneBillCalculator {

    public static long calculateCallDuration(LocalDateTime startTime, LocalDateTime endTime) {
        Duration duration = Duration.between(startTime, endTime);
        long seconds = duration.getSeconds();
        // 将秒数向上取整到分钟
        long minutes = (seconds + 59) / 60;
        return minutes;
    }

    public static double calculateCallCost(long minutes) {
        if (minutes <= 20) {
            return minutes * 0.05;
        } else {
            return 1.00 + (minutes - 20) * 0.10;
        }
    }
}
